package com.gzz.orchid.common.core.tuple;

/**
 * @author higmd
 */
public class PhaseId implements Comparable<Object> {
    private static final String ANY_PHASE_NAME = "ANY";
    public static final PhaseId ANY_PHASE = new PhaseId(ANY_PHASE_NAME);
    private static final String RESTORE_VIEW_NAME = "RESTORE_VIEW";
    public static final PhaseId RESTORE_VIEW = new PhaseId(RESTORE_VIEW_NAME);
    private static int nextOrdinal = 0;
    private final int ordinal;
    private final String phaseName;

    public PhaseId(String phaseName) {
        this.phaseName = phaseName;
        this.ordinal = nextOrdinal++;
    }

    @Override
    public int compareTo(Object o) {
        return this.ordinal - ((PhaseId) o).ordinal;
    }
}
